package com.example.demo.controller;

import com.example.demo.entity.TopicOption;
import com.example.demo.service.Topicservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("ping")
public class PingController {

    @Autowired
    Topicservice topicservice;


    @RequestMapping
    public String topic (){

        return "ping/spec";
    }
    @RequestMapping("test")
    public String test (){

        return "ping/test";
    }

    //获取到题
    @RequestMapping("list")
    @ResponseBody
    public TopicOption listoption(@RequestParam(defaultValue = "1") Integer tid){
        TopicOption listoption = topicservice.listoption(tid);
        System.out.println(listoption);
        return listoption;
    }
}
